#pragma once
#include "DXAMLCommon.h"
#include "IValueStore.h"
#include "CValue.h"
#include "CXMLNode.h"



class CXMLParser
{

private: 
	CXMLParser(struct IValueStore * pTags, struct IValueStore * pAttrs, XBOOL fStrict);
	~CXMLParser();
public: 
	static HRESULT LoadXml(struct IValueStore * pTags, struct IValueStore * pAttrs, XUINT32 cSource, XUINT8 * pSource, CXString * pstrExpectedDocType, CXString * pstrExpectedDTDUrl, XBOOL fStrict, CValue & valueRoot, XBOOL fIgnoreDocumentTag);
	static HRESULT LoadXml(struct IValueStore * pTags, struct IValueStore * pAttrs, XUINT32 cSource, XUINT8 * pSource, CValue &);
	static HRESULT StripLeadingWhitespace(XUINT32 * cSource, XUINT8 * * pSource);
private: 
	HRESULT StartDocument();
	HRESULT EndDocument();
	HRESULT StartElement(XUINT32 cName, XCHAR * pName);
	HRESULT EndElement();
	HRESULT Attribute(XUINT32 cName, XCHAR * pName, XUINT32 cValue, XCHAR * pValue);
	HRESULT Characters(XUINT32 cString, XCHAR * pString);
	CValue m_valueRoot;
private: 
	CXMLNode * m_pStack;
	struct IValueStore * m_pTagDictionary;
	struct IValueStore * m_pAttributeDictionary;
	XBOOL m_fStrict;
};
